<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script>
        autoCompleteNew("name");
    function autoCompleteNew(inputId){
        var patientIdOfMother = $("#patientIdOfMother").val();
        var vistIdOfMother = $("#vistIdOfMother").val();
        var url="${ctx}/nurse/newbornRec/autoComplete?patientIdOfMother="+patientIdOfMother+"&vistIdOfMother="+vistIdOfMother;
        autoComplete(inputId,url,
            function(data){
                var rows = [];
                for(var i=0; i<data.length; i++){
                    rows[rows.length] = {
                        data:data[i],
                        value:data[i].id,
                        result:data[i].name
                    };
                }
                return rows;
            },function(data, i, max){
                return data.name+"|"+data.dateOfBirth
            },function(event,data,formatted){
                $("#id").val(data.id);
                $('#motherName').val(data.nameOfMother);
                $('#birthDate').val(data.dateOfBirth);
                $('#birthCertifiaationNo').val(data.birthCertifiaationNo);
                $('#motherInpNo').val(data.motherInpNo);
                $('#patientIdOfMother').val(data.patientIdOfMother);

                 $('#sex').val(data.sex);
                $('#sex').change();
                $('#sheng').val(data.birthPlaceProvince);
                $('#shi').val(data.birthPlaceCity);
                $('#xian').val(data.birthPlaceCounty);
                 $('#birthPlace').val(data.birthPlaceTownship);

            })
    }
</script>

<div class="content-wrap">
    <div class="wrapper" style="bottom: 50px;">
        <ul class="nav nav-tabs">
            <li>
                <a href="#" onclick="loadDiv('rigthCenterDiv','${ctx}/nurse/newbornRec/newBornHosList?vistIdOfMother=${newBorn.vistIdOfMother}')"> 新生儿住院列表</a>
            </li>
            <li class="active">
                <a href="#" onclick="loadDiv('rigthCenterDiv','${ctx}/nurse/newbornRec/getInHosInfo?vistIdOfMother=${newBorn.vistIdOfMother}')">
                    <c:choose>
                        <c:when test="${newBorn.id==''|| newBorn.id==null}">
                            新生儿住院添加
                        </c:when>
                        <c:otherwise>新生儿住院修改</c:otherwise>
                    </c:choose>
                </a>
            </li>
        </ul>
        <section class="panel">
            <div class="panel-body">
                <form class="form-horizontal"  data-parsley-validate="" id="newBornInfo" role="form" onsubmit="return formSaveLoad('rigthCenterDiv','newBornInfo','${ctx}/nurse/newbornRec/saveInHosInfo','${ctx}/nurse/newbornRec/newBornHosList?vistIdOfMother=${newBorn.vistIdOfMother}&patientIdOfMother=${newBorn.patientIdOfMother}&motherInpNo=${newBorn.motherInpNo}');" method="post">
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="name">新生儿姓名:</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control" id="name" name="name" value="${newBorn.name}" >
                            <input id="id" name="id" type="hidden" value="${newBorn.id}"/>
                        </div>

                        <div class="col-sm-1">
                            <select name="sex" class="form-control" id="sex" data-parsley-required="true">
                                <c:forEach items="${fns:getDictList('SEX_DICT')}" var="sex">
                                    <option value="${sex.value}" <c:if test="${newBorn.sex eq sex.value}">selected</c:if>>${sex.label}</option>
                                </c:forEach>
                            </select>
                        </div>
                        <label class="col-sm-1 control-label" for="bebNo">床号:</label>
                        <div class="col-sm-2">
                            <input type="text" class="form-control" id="bebNo" data-parsley-required="true" name="bedNo" value="${newBorn.bedNo}"  readonly>
                        </div>
                    </div>
                    <div class="form-group">

                        <label class="col-sm-2 control-label">出生证号:</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control" id="birthCertifiaationNo" name="birthCertifiaationNo" value="${newBorn.birthCertifiaationNo}" readonly>
                        </div>
                        <label class="col-sm-2 control-label" for="babInpNo">住院号：</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control" id="babInpNo" name="babyInpNo" value="${newBorn.babyInpNo}" readonly>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="motherName">母亲姓名:</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control"  id="motherName" name="nameOfMother" value="${newBorn.nameOfMother}" readonly>
                        </div>
                        <label class="col-sm-2 control-label" for="motherInpNo">母亲住院号：</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control" id="motherInpNo" name="motherInpNo" value="${newBorn.motherInpNo}" readonly>
                            <input type="hidden" class="form-control" id="patientIdOfMother" name="patientIdOfMother" value="${newBorn.patientIdOfMother}">
                            <input type="hidden" class="form-control" id="vistIdOfMother" name="vistIdOfMother" value="${newBorn.vistIdOfMother}">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="identity">身份:</label>
                        <div class="col-sm-3">
                            <select name="patMasterIndex.identity" class="form-control" id="identity">

                                <c:forEach items="${fns:getDictList('PROFESSION_DICT')}" var="profession">
                                    <option value="${profession.value}" <c:if test="${newBorn.patMasterIndex.identity eq profession.value}">selected</c:if>>${profession.label}</option>
                                </c:forEach>
                            </select>
                        </div>
                        <label class="col-sm-2 control-label" for="chargeType">费别:</label>
                        <div class="col-sm-3">
                            <select name="patMasterIndex.chargeType" class="form-control" id="chargeType">
                                <c:forEach items="${fns:getDictList('CHARGE_TYPE_DICT')}" var="chargeType">
                                    <option value="${chargeType.value}" <c:if test="${newBorn.patMasterIndex.chargeType eq chargeType.value}">selected</c:if>>${chargeType.label}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="birthDate">出生日期:</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control Wdate" id="birthDate" readonly name="dateOfBirth" value="<fmt:formatDate value="${newBorn.dateOfBirth}" pattern="yyyy-MM-dd"/>"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" required>
                        </div>
                        <label class="col-sm-2 control-label">入院日期:</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control Wdate" id="inHosDate" name="patVisit.admissionDate"  value="<fmt:formatDate value="${newBorn.patVisit.admissionDate}" pattern="yyyy-MM-dd"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false,minDate:'%y-%M-%d'});" data-parsley-required="true">
                        </div>

                    </div>
                    <div class="form-group">


                        <label class="col-sm-2 control-label" >入院情况:</label>
                        <div class="col-sm-3">
                            <sys:select checkValue="${newBorn.patVisit.hospitalSituation}" name="patVisit.hospitalSituation" lists="${fns:getDictList('ADMISSION_SITUATION_DICT')}" className="form-control" ></sys:select>
                        </div>

                        <label class="col-sm-2 control-label">发病日期:</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control Wdate" id="situationDate" name="patVisit.situationDate" value="<fmt:formatDate value="${newBorn.patVisit.situationDate}" pattern="yyyy-MM-dd"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false,maxDate:'%y-%M-%d'});" >
                        </div>
                    </div>
                    <div class="form-group">

                        <label class="col-sm-2 control-label" for="weight">入院体重:</label>
                        <div class="col-sm-3">
                            <div class="input-group mb2">
                            <input type="text" class="form-control" id="weight" name="weight" value="${newBorn.weight}" data-parsley-type="number"  maxlength="4"><span class="input-group-btn"><button class="btn btn-default" type="button">G</button></span>
                            </div>
                        </div>
                        <label class="col-sm-2 control-label" >入院身高:</label>
                        <div class="col-sm-3">
                            <div class="input-group mb2">
                            <input type="text" class="form-control" id="height" name="height" value="${newBorn.height}" data-parsley-type="number" maxlength="3"><span class="input-group-btn"><button class="btn btn-default" type="button">CM</button></span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" >出生地:</label>

                        <div class="col-sm-1">
                            <input type="text" class="form-control" id="sheng" name="birthPlaceProvince" value="${newBorn.birthPlaceProvince}" placeholder="省" readonly>
                        </div>
                        <div class="col-sm-1">
                            <input type="text" class="form-control" id="shi" name="birthPlaceCity" value="${newBorn.birthPlaceCity}" placeholder="市" readonly>
                        </div>
                        <div class="col-sm-1">
                            <input type="text" class="form-control" id="xian" name="birthPlaceCounty" value="${newBorn.birthPlaceCounty}" placeholder="县" readonly>
                        </div>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="birthPlace" name="birthPlaceTownship" value="${newBorn.birthPlaceTownship}" placeholder="具体出生地" readonly>
                        </div>

                    </div>
                    <div class="form-group pull-right">
                        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存">
                    </div>
                </form>

            </div>
        </section>
    </div>
</div>